package smedi.ismedi.mobile.bff.controller.constructionproject;

import com.smedi.ismedi.constructionproject.api.dto.request.*;
import com.smedi.ismedi.constructionproject.api.dto.response.ProjectApplyResponse;
import com.smedi.ismedi.constructionproject.api.feign.RemoteProjectApplyFeignApi;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import smedi.ismedi.mobile.bff.controller.BaseController;


import java.util.List;

/**
 * 项目分配接口
 *
 * @author xulinjun
 */
@Slf4j
@RestController
@Api(tags = {"项目申请接口"})
@RequestMapping("/mobilebff/v1/projectApply")
@AllArgsConstructor
public class ProjectApplyController extends BaseController {
    private final RemoteProjectApplyFeignApi remoteProjectApplyFeignApi;
    /**
     * 主体院分管领导审批 项目申请
     *
     * @param processInstituteLeaderApprovalRequest 主体院分管领导审批 项目申请
     * @return ResponseData<ProjectApplyResponse>
     */
    @ApiOperation(value = "主体院分管领导审批 项目申请", nickname = "主体院分管领导审批 项目申请")
    @PostMapping (value = "/project/institute-leader-approval")
    ResponseData<ProjectApplyResponse> instituteLeaderApproval(@Validated @RequestBody ProcessInstituteLeaderApprovalRequest processInstituteLeaderApprovalRequest){

        return remoteProjectApplyFeignApi.instituteLeaderApproval(processInstituteLeaderApprovalRequest);
    }
    /**
     * 工程部工程师审批 项目申请
     *
     * @param processEngineerApprovalRequest 工程部工程师审批 项目申请
     * @return ResponseData<ProjectApplyResponse>
     */
    @ApiOperation(value = "工程部工程师审批 项目申请", nickname = "工程部工程师审批 项目申请")
    @PostMapping (value = "/project/engineer-approval")
    ResponseData<ProjectApplyResponse> engineerApproval(@Validated @RequestBody ProcessEngineerApprovalRequest processEngineerApprovalRequest){

        return remoteProjectApplyFeignApi.engineerApproval(processEngineerApprovalRequest);
    }
    /**
     * 工程部分管领导审批 项目申请
     *
     * @param processEngineeringLeaderApprovalRequest 工程部分管领导审批 项目申请
     * @return ResponseData<ProjectApplyResponse>
     */
    @ApiOperation(value = "工程部分管领导审批 项目申请", nickname = "工程部分管领导审批 项目申请")
    @PostMapping (value = "/project/engineering-leader-approval")
    ResponseData<ProjectApplyResponse> engineeringLeaderApproval(@Validated @RequestBody ProcessEngineeringLeaderApprovalRequest processEngineeringLeaderApprovalRequest){

        return remoteProjectApplyFeignApi.engineeringLeaderApproval(processEngineeringLeaderApprovalRequest);
    }
    /**
     * 总院分管领导审批 项目申请
     *
     * @param processGeneralInstituteLeaderApprovalRequest 总院分管领导审批 项目申请
     * @return ResponseData<ProjectApplyResponse>
     */
    @ApiOperation(value = "总院分管领导审批 项目申请", nickname = "总院分管领导审批 项目申请")
    @PostMapping (value = "/project/general-institute-leader-approval")
    ResponseData<ProjectApplyResponse> generalInstituteLeaderApproval(@Validated @RequestBody ProcessGeneralInstituteLeaderApprovalRequest processGeneralInstituteLeaderApprovalRequest){

        return remoteProjectApplyFeignApi.generalInstituteLeaderApproval(processGeneralInstituteLeaderApprovalRequest);
    }
    /**
     * 获取 项目申请 详情
     *
     * @param id 项目申请 详情
     * @return ResponseData<PaginationData<ProjectApplyResponse>>
     */
    @ApiOperation(value = "详情", nickname = "详情")
    @GetMapping (value = "/detail")
    ResponseData<ProjectApplyResponse> projectApplyDetail(@RequestParam("id") Long id) {

        return remoteProjectApplyFeignApi.projectApplyDetail(id);
    }
}
